<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 过渡样式 */
        .xxx-enter-active,
        .xxx-leave-active {
            transition: opacity 3s;
        }

        /* 隐藏时的样式 */
        .xxx-enter,
        .xxx-leave-to {
            opacity: 0;
        }
        /* 
        xxx-enter-active表示从看不见到看的见  进入
        xxx-leave-active表示从看的见到看不见  离开
        xxx-enter 表示进入前是看不见
        xxx-leave-to 表示从看的见到看不见
         */
         .move-enter-active{
             transition: all 4s;
         }
         .move-leave-active{
             transition:all 10s;
         }
         .move-enter,.move-leave-to{
             opacity: 0;
             transform: translateX(1500px);
         }
    </style>
</head>

<body>
<div id="demo">
    <button @click="show=!show">
        toggle
    </button>
    <!-- 
        transition是Vue自己封装的组件，要使用Vue提供的
        过渡需要让transition组件将目标元素进行包裹
    -->
    <transition name="xxx">
        <p v-show="show">hello</p>
    </transition>
</div>

<div id="test">
    <button @click="show = !show">
        Toggle
    </button>
    <transition name="move">
        <p v-show="show">hello</p>
    </transition>
</div>
<script src="../js/vue.js"></script>
<script>
    new Vue({
        el:'#demo',
        data:{
            show:true
        }
    })

    new Vue({
        el:'#test',
        data:{
            show:true
        }
    })
</script>
</body>

</html>